// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import { XHeader, Search, WechatPlugin, Flexbox, FlexboxItem, Icon } from 'vux'
import Axios from 'axios';
// require('../node_modules/vconsole/dist/vconsole.min')
// import vConsole from 'vconsole'
// const vConsole = new VConsole();
// import VueWechatTitle from 'vue-wechat-title'
Vue.component('x-header', XHeader)
Vue.component('flexbox', Flexbox)
Vue.component('flexbox-item', FlexboxItem)
Vue.component('icon', Icon)
Vue.component('search', Search)
Vue.config.productionTip = false
Vue.use(WechatPlugin)
// Vue.use(vConsole)
// Vue.use(VueWechatTitle)
// Vue.use(require('vue-wechat-title'))

// Axios.post('/api/getsignature', {
//   url: location.href.split('#')[0]
// }).then((res) => {
//   Vue.wechat.config({
//     beta: true,
//     debug: true,
//     appId: res.data.appId,
//     timestamp: res.data.timestamp,
//     nonceStr: res.data.nonceStr,
//     signature: res.data.signature,
//     jsApiList: ['getLocation']
//   });
// });

router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = '便民服务';
    document.title = document.title + '-' + to.meta.title; 
  }
  next();
});
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  // vConsole,
  components: { App },
  template: '<App/>'
})
